<template>
  <span :style="{color: color}">{{ rate | formatPer }}</span>
</template>

<script>
// @是src的别名
import filters from "@/utils/filters";
import Vue from "vue";

export default {
  name: "AvgRate",
  data() {
    return {
      rate: 0
    }
  },
  props: ['color'],
  filters,
  created() {
    console.log('请求后台获取数据');

    Vue.axios.get("/product/rate").then(resp => {
      this.rate = resp.data;
      console.log(resp.data);
    })
  }
}
</script>

<style scoped>

</style>